// https://www.luogu.com.cn/problem/P1305

#include <iostream>
#include <cstring>
using namespace std;

char msg[5];
char root;
char leftChildren[100];
char rightChildren[100];

void preorder(const char ch) {
    if (ch != '*') {
        printf("%c", ch);
        const int tmp = ch - 'a';
        preorder(leftChildren[tmp]);
        preorder(rightChildren[tmp]);
    }
}

int main() {
    int n;
    scanf("%d", &n);
    scanf("%s", msg);
    memset(leftChildren, '*', sizeof leftChildren);
    memset(rightChildren, '*', sizeof rightChildren);
    root = msg[0]; leftChildren[root-'a'] = msg[1]; rightChildren[root-'a'] = msg[2];
    for (int i = 1; i < n; i++) {
        scanf("%s", msg);
        char tmpRoot = msg[0];
        leftChildren[tmpRoot-'a'] = msg[1]; rightChildren[tmpRoot-'a'] = msg[2];
    }
    preorder(root);
    return 0;
}